﻿<%@ Page Title="" Language="C#" MasterPageFile="~/TsSite.Master" AutoEventWireup="true" CodeBehind="TireMount.aspx.cs" Inherits="TireService.Web.View.OperatorView.TireMount" %>

<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxLoadingPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxCallback" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxCallbackPanel" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v11.1, Version=11.1.12.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <!-- Javascript variables used in control -->
    <script language="javascript" type="text/javascript">

        
        // Perform callback that marks selected quotation as mounted
        function MarkTireSetAsMounted(quotationid) {
            var answer = confirm("Angiv som monteret?")
            if (answer) {
                LoadingPanel.Show();

                // Run callback function to mark quotation as mounted
                callMarkTireSetAsMounted.PerformCallback(quotationid);
            }
        }

        // Function that runs when server side completed processing of handling mark tireset as mounted
        function OnCallbackMarkTireSetAsMountedCompleted(s, e) {
            gvTireMount.PerformCallback();

            LoadingPanel.Hide();

            //alert('Handling udført');
        }

        // Function that return error in case callback to server failed
        function CallBackError(s, e) {
            LoadingPanel.Hide();

            alert('Fejl opstod: ' + e.message);
        }

    </script>

    <dx:ASPxLoadingPanel ID="LoadingPanel" Text="Vent venligst..." ClientInstanceName="LoadingPanel" runat="server" Modal="True">
    </dx:ASPxLoadingPanel>

    <dx:ASPxCallback ID="callMarkTireSetAsMounted" ClientInstanceName="callMarkTireSetAsMounted" runat="server" OnCallback="callMarkTireSetAsMounted_Callback">
        <ClientSideEvents CallbackError="CallBackError" CallbackComplete="OnCallbackMarkTireSetAsMountedCompleted" />
    </dx:ASPxCallback>

    <dx:ASPxGridView ID="gvTireMount" runat="server" Caption="Dæk montering"
        KeyFieldName="CarId" AutoGenerateColumns="False" ClientInstanceName="gvTireMount"
        OnCustomCallback="gvTireMount_CustomCallback" OnHtmlRowPrepared="gvTireMount_HtmlRowPrepared">
        <SettingsBehavior ProcessFocusedRowChangedOnServer="false" AllowFocusedRow="false" />
        <SettingsPager AlwaysShowPager="True" PageSize="25" Position="Bottom">
            <Summary 
                AllPagesText="Sider: {0} - {1} ({2} sager)" 
                Text="Side {0} af {1} ({2} sager)" />
        </SettingsPager>
        <Columns>
            <%--<dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0">
                    <HeaderTemplate>
                        <input type="checkbox" onclick="gvDayPlan.SelectAllRowsOnPage(this.checked);" style="vertical-align:middle;" title="Vælg/Fravælg alle linjer på siden"></input>
                    </HeaderTemplate>
                    <HeaderStyle Paddings-PaddingTop="1" Paddings-PaddingBottom="1" 
                        HorizontalAlign="Center">
                    <Paddings PaddingTop="1px" PaddingBottom="1px"></Paddings>
                    </HeaderStyle>
            </dx:GridViewCommandColumn>--%>
            <dx:GridViewDataTextColumn FieldName="QuotationReferenceId" VisibleIndex="0" Visible="false" />
            <dx:GridViewDataTextColumn FieldName="CarId" VisibleIndex="0" Visible="false" />
            <dx:GridViewDataTextColumn FieldName="CustomerId" VisibleIndex="0" Caption="Kundenr" />
            <dx:GridViewDataTextColumn FieldName="RegistrationNumber" VisibleIndex="0" Caption="Reg.nr" />
            <dx:GridViewDataTextColumn FieldName="Description" VisibleIndex="0" Caption="Til montering" />
            <dx:GridViewDataTextColumn FieldName="Quantity" VisibleIndex="0" Caption="Antal" />
            <dx:GridViewDataTextColumn FieldName="ContainerNumber" VisibleIndex="0" Caption="Lager" />
            <dx:GridViewDataTextColumn FieldName="CargoRoomNumber" VisibleIndex="0" Caption="Lagerplads" />
            <dx:GridViewDataTextColumn FieldName="VF" VisibleIndex="0" Caption="VF" />
            <dx:GridViewDataTextColumn FieldName="HF" VisibleIndex="0" Caption="HF" />
            <dx:GridViewDataTextColumn FieldName="VB" VisibleIndex="0" Caption="VB" />
            <dx:GridViewDataTextColumn FieldName="HB" VisibleIndex="0" Caption="HB" />
            <dx:GridViewDataTextColumn FieldName="Ordered" VisibleIndex="0" Caption="Dæk bestilt" />
            <dx:GridViewDataColumn>
                <DataItemTemplate>
                    <dx:ASPxButton ID="btnInsert" runat="server" ClientInstanceName="btnInsert" Text="Montering gennemført" ToolTip="Klik for at færdigmelde montering af dæk" AutoPostBack="false"
                        ClientSideEvents-Click='<%# "function(s, e) { MarkTireSetAsMounted(" + Container.KeyValue + "); }" %>'>
                    </dx:ASPxButton>                                           
                </DataItemTemplate>
            </dx:GridViewDataColumn>
        </Columns>
        <SettingsLoadingPanel Mode="ShowOnStatusBar" />
        <Styles>
            <Header ImageSpacing="5px" SortingImageSpacing="5px" />
        </Styles>
    </dx:ASPxGridView>

</asp:Content>
